//虚拟节点法

var deleteNode = function (head, val) {
    let dummy = new ListNode()
    dummy.next = head

    let cur = head


    while (cur.next != null) {
        if (cur.next.val === val) {

            cur.next = cur.next.next

        } else {
            cur = cur.next
        }

    }

    return dummy.next
};